#ifndef DW_GRAFFITI_IMAGE_MANAGER_H
#	define DW_GRAFFITI_IMAGE_MANAGER_H

#include "base/singleton.h"

namespace dw {
	namespace graffiti {

class Image;

class ImageManager
:	public dw::base::Singleton< ImageManager, false >
{
public : //! @name Types definitions
	//! @{
	typedef dw::base::Singleton< ImageManager, false > base;
	//! @}

public : //! @name Life cycle commands
	//! @{
	void initialize();
	void terminate();
	//! @}

public : //! @name Commands
	//! @{
	const Image* get(const std::string& filePath);
	const Image* load(const std::string& filePath);
	void unload(const Image* image);

	void save(const std::string& filePath, const Image* image);
	//! @}

private : //! @name Internal commands
	//! @{
	Image* load(std::istream& is);
	//! @}

private : //! @name Construction & Destruction
	//! @{
	ImageManager();
	~ImageManager();

	friend class base;
	//! @}

private : //! @name Types definitions
	//! @{
	typedef std::map< const std::string, const Image* > ImagesMap;
	//! @}

private : //! @name Data
	//! @{
	ImagesMap m_images;
	//! @}
};

	} // namespace graffiti
} // namespace dw

#include "imagemanager.inl"

#endif // !DW_GRAFFITI_IMAGE_MANAGER_H
